Integrand size = 31, antiderivative size = 131 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {B \text {arctanh}(\sin (c+d x))}{b^2 d}-\frac {2 \left (A b^3+a^3 B-2 a b^2 B\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} b^2 (a+b)^{3/2} d}+\frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \]
[Out]
Time = 0.33 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {4094, 4083, 3855, 3916, 2738, 214} \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=-\frac {2 \left (a^3 B-2 a b^2 B+A b^3\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^2 d (a-b)^{3/2} (a+b)^{3/2}}+\frac {a (A b-a B) \tan (c+d x)}{b d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac {B \text {arctanh}(\sin (c+d x))}{b^2 d} \]
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4083
Rule 4094
Rubi steps \begin{align*} \text {integral}& = \frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\int \frac {\sec (c+d x) \left (-b (A b-a B)+\left (a^2-b^2\right ) B \sec (c+d x)\right )}{a+b \sec (c+d x)} \, dx}{b \left (a^2-b^2\right )} \\ & = \frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {B \int \sec (c+d x) \, dx}{b^2}-\frac {\left (A b^3+a \left (a^2-2 b^2\right ) B\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{b^2 \left (a^2-b^2\right )} \\ & = \frac {B \text {arctanh}(\sin (c+d x))}{b^2 d}+\frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\left (A b^3+a \left (a^2-2 b^2\right ) B\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b^3 \left (a^2-b^2\right )} \\ & = \frac {B \text {arctanh}(\sin (c+d x))}{b^2 d}+\frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\left (2 \left (A b^3+a \left (a^2-2 b^2\right ) B\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^3 \left (a^2-b^2\right ) d} \\ & = \frac {B \text {arctanh}(\sin (c+d x))}{b^2 d}-\frac {2 \left (A b^3+a^3 B-2 a b^2 B\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} b^2 (a+b)^{3/2} d}+\frac {a (A b-a B) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \\ \end{align*}
Time = 0.93 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.46 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {\cos (c+d x) (A+B \sec (c+d x)) \left (\frac {2 \left (A b^3+a \left (a^2-2 b^2\right ) B\right ) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {a b (-A b+a B) \sin (c+d x)}{(-a+b) (a+b) (b+a \cos (c+d x))}\right )}{b^2 d (B+A \cos (c+d x))} \]
[In]
[Out]
Time = 0.93 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.41
method | result | size |
derivativedivides | \(\frac {\frac {B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}+\frac {-\frac {2 a b \left (A b -B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {2 \left (A \,b^{3}+B \,a^{3}-2 B a \,b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{b^{2}}-\frac {B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}}{d}\) | \(185\) |
default | \(\frac {\frac {B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}+\frac {-\frac {2 a b \left (A b -B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {2 \left (A \,b^{3}+B \,a^{3}-2 B a \,b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{b^{2}}-\frac {B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}}{d}\) | \(185\) |
risch | \(-\frac {2 i \left (-A b +B a \right ) \left (b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{\left (a^{2}-b^{2}\right ) d b \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{b^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{b^{2} d}\) | \(619\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 319 vs. \(2 (123) = 246\).
Time = 2.36 (sec) , antiderivative size = 694, normalized size of antiderivative = 5.30 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\left [\frac {{\left (B a^{3} b - 2 \, B a b^{3} + A b^{4} + {\left (B a^{4} - 2 \, B a^{2} b^{2} + A a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5} + {\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5} + {\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (B a^{4} b - A a^{3} b^{2} - B a^{2} b^{3} + A a b^{4}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} d\right )}}, -\frac {2 \, {\left (B a^{3} b - 2 \, B a b^{3} + A b^{4} + {\left (B a^{4} - 2 \, B a^{2} b^{2} + A a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5} + {\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5} + {\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B a^{4} b - A a^{3} b^{2} - B a^{2} b^{3} + A a b^{4}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} d\right )}}\right ] \]
[In]
[Out]
\[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\int \frac {\left (A + B \sec {\left (c + d x \right )}\right ) \sec ^{2}{\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{2}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
none
Time = 0.34 (sec) , antiderivative size = 231, normalized size of antiderivative = 1.76 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=-\frac {\frac {2 \, {\left (B a^{3} - 2 \, B a b^{2} + A b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{2} b^{2} - b^{4}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {B \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{2}} + \frac {B \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{2}} - \frac {2 \, {\left (B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a^{2} b - b^{3}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )}}}{d} \]
[In]
[Out]
Time = 22.00 (sec) , antiderivative size = 3751, normalized size of antiderivative = 28.63 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\text {Too large to display} \]
[In]
[Out]